package com.soulkun.smarthome.ui.main.home.adapter

import android.content.Context
import android.view.View
import androidx.databinding.ObservableArrayList
import androidx.databinding.ViewDataBinding
import com.soulkun.smarthome.R
import com.soulkun.smarthome.databinding.AppRecycleItemMainHomeFamilyListBinding
import com.soulkun.smarthome.logic.vo.FamilyVO
import soulkun.library.mvvm.adapter.BaseDataBindingRecyclerViewAdapter

class AppMainHomeFamilyListAdapter(
    context: Context,
    dataList: ObservableArrayList<FamilyVO>,
    private val onClickListener: (ViewDataBinding) -> View.OnClickListener
) :
    BaseDataBindingRecyclerViewAdapter<FamilyVO>(context, dataList) {

    override fun getContentLayoutResId(): Int {
        return R.layout.app_recycle_item_main_home_family_list
    }

    override fun setContentViewHolderCreateListener(binding: ViewDataBinding) {
    }

    override fun setContentViewHolderBindListener(binding: ViewDataBinding, dataPosition: Int) {
        (binding as AppRecycleItemMainHomeFamilyListBinding).familyVO = dataList[dataPosition]
        binding.onClickListener = onClickListener(binding)
    }
}